public class Node {
    private Object data;
    private Node next;

    public static void main(String[] args) {
        Node node = new Node();
        node.data = "root";

        Node nodeFirst = new Node();
        nodeFirst.data="first";

        Node node2 = new Node();
        node2.data="2";

        nodeFirst.next = node2;

        node.next = nodeFirst;
        System.out.println(node);
    }

    @Override
    public String toString() {
        return "Node{" +
                "data=" + data +
                ", next=" + next +
                '}';
    }
}
